package com.qyhl.webtv.module_live.teletext.newlivelist.item;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.qyhl.webtv.commonlib.constant.ARouterPathConstant;
import com.qyhl.webtv.commonlib.entity.live.LiveRoomBean;
import com.qyhl.webtv.commonlib.utils.router.RouterManager;
import com.qyhl.webtv.module_live.R;
import com.zhy.adapter.recyclerview.base.ItemViewDelegate;
import com.zhy.adapter.recyclerview.base.ViewHolder;

public class TagItemView implements ItemViewDelegate<LiveRoomBean> {
    private Context context;

    public TagItemView(Context context) {
        this.context = context;
    }

    @Override
    public int getItemViewLayoutId() {
        return R.layout.live_item_newlive_list_tag;
    }

    @Override
    public boolean isForViewType(LiveRoomBean liveRoomBean, int i) {
        return liveRoomBean.getLivetype().equals("tag");
    }

    @Override
    public void convert(final ViewHolder viewHolder, final LiveRoomBean liveRoomBean, int i) {
        if (liveRoomBean.getType().equals("1")) {
            viewHolder.setText(R.id.live_tag_title, "全媒体直播");
        } else {
            viewHolder.setText(R.id.live_tag_title, "互动直播");
        }

        viewHolder.getView(R.id.live_more).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (liveRoomBean.getType().equals("1")) {
                    Bundle bundle = new Bundle();
                    bundle.putString("title", "全媒体直播");
                    RouterManager.router(ARouterPathConstant.TELETEXT_LIST,bundle);

                } else {
                }
            }
        });

        if (liveRoomBean.isLimited()) {
            viewHolder.setVisible(R.id.live_more, true);
        } else {
            viewHolder.setVisible(R.id.live_more, false);
        }
    }
}
